<?php
/***
 * 描述：商铺设置[管理员权限]
 * @category		Admin		
 * @package			Action			
 * @subpackage			
 * @author			wanght <whtaok@gmail.com>
 * @since			2013-4-6
 * @version			$Id: ShopSettingAction.class.php 34 2013-10-27 02:29:45Z whtaok@gmail.com $
 */
class ShopSettingAction extends AdminAction {
	/**
	 *
	 * @access		protected
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	protected  function _initialize() {
		parent::_initialize();
		$this->usingModel="ShopSetting";
	}	
	
	/**
	 * 商铺设定首页面
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	public function indexAct() {
		$search = array(
				'title'=>I('title'),
				'type'=>I('type'),
				'shop_id'=>$this->curr_shop_id,
			);
		$mod=new CommonModel($this->usingModel);
		$list = $mod->setModWhere($search)->order('ordlist desc')->select();
		$this->assign('list',$list);
		$this->assign('search',$search);
		$this->display('index');
	}
	
	/**
	 * 显示添加页面
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	public function showAddAct() {
		$this->display('add');
	}
	
	/**
	 * 添加操作
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	public function doAddAct() {
		$mod=new CommonModel($this->usingModel);
		if(!$mod->create()){
			$this->error($mod->getError());
		}
		$mod->shop_id = $this->curr_shop_id;
		$mod->add();
		$this->success('添加成功', U('index'));
	}
	
	/**
	 * 显示编辑页面
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	public function showUpdAct($id) {
		$mod=new CommonModel($this->usingModel);
		$detail = $mod->find($id);
		$this->assign("detail",$detail);
		$this->display('upd');
	}	
	
	/**
	 * 编辑操作
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	public function doUpdAct($id) {
		$mod=new CommonModel($this->usingModel);
		if(!$mod->create()){
			$this->error($mod->getError());
		}
		$mod->save();
		$this->success('保存成功', U('index'));
	}
	
	/**
	 * 显示编辑复合内容页面
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	public function showUpdContentAct($id) {
		$mod=new CommonModel($this->usingModel);
		$detail = $mod->find($id);
		$this->assign("detail",$detail);
		$this->display('upd_content');
	}
	
	/**
	 * 删除操作
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-3-3
	 */
	public function doDelAct($id) {
		$mod=new CommonModel($this->usingModel);
		$mod->delete($id);
		$this->success('删除成功', U('index'));
	}	

}

?>